﻿#ifndef C51_SOS_H_
#define C51_SOS_H_

#include<reg52.h>
#include<stdio.h>

#define OS_START_SP_INIT(sp,taskStackTop) sp = taskStackTop;

#define STACK_PUSH_OP(sp) 

#define STACK_POP_OP() 
	
#define CHANGE_SP_TO_RUNNING_TASK(sp,runningTaskStackTop) sp = runningTaskStackTop;

#define SOS_TIMER_INTERRUPT void idle(void)  

#define SOS_TIMER_CLEAR(timerInitValue)    

#define SOS_TIMER_INIT(timerInitValue) 


#define SOS_TASK_STACK_INIT(taskName,taskId,tcbTaskStackTop,manualStack)  {															\
	unsigned char *locStack = &manualStack[taskId * 15];													\
	*locStack++ = (unsigned int)taskName;																\
	*locStack = (unsigned int)taskName>>8; /*将任务的地址高位压入堆栈*/									\
	tcbTaskStackTop = (unsigned int)locStack; /*将人工堆栈的栈顶，保存到堆栈的数组中*/		\
}

#define TASK_STACK_SIZE(sosSupportTaskNum) sosSupportTaskNum * 15 + 5

#endif
